Imports System.IO
Public Class deactivation
    Inherits System.Web.UI.Page
    Protected WithEvents Image2 As System.Web.UI.WebControls.Image
    Protected WithEvents Image1 As System.Web.UI.WebControls.Image
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink
    Protected WithEvents Lbl_date As System.Web.UI.WebControls.Label
    Protected WithEvents Label6 As System.Web.UI.WebControls.Label
    Protected WithEvents lbl_user As System.Web.UI.WebControls.Label
    Protected WithEvents Label3 As System.Web.UI.WebControls.Label
    Protected WithEvents fileToUpload As System.Web.UI.HtmlControls.HtmlInputFile


#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Put user code to initialize the page here
        Dim SQL As String
        Dim SQL1 As String
        Dim usr As String
        Dim ds As New myDBConn()
        Session.LCID = 1055

        If Page.IsPostBack Then Exit Sub
        Me.Lbl_date.Text = Now.ToShortDateString
        usr = Request.ServerVariables("LOGON_USER")
        SQL = "SELECT a.name FROM USERS a,perms p WHERE  a.usrid=p.usrid and a.LOGUSR= '" & usr & "' and appid=7;"

        If ds.myOleDbTable(SQL).Rows.Count > 0 Then
            Me.lbl_user.Text = ds.myOleDbTable(SQL).Rows(0)(0)
        Else
            Response.Redirect("logout.htm")
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim savePath As String = "C:\temp\"
        If Not (FiletoUpload.PostedFile Is Nothing) Then
            Try
                Dim postedFile = FiletoUpload.PostedFile
                Dim filename As String = Path.GetFileName(postedFile.FileName)
                Dim contentType As String = postedFile.ContentType
                Dim contentLength As Integer = postedFile.ContentLength

                postedFile.SaveAs(savePath & filename)
                Me.Label1.Text = postedFile.Filename & " uploaded" & _
                  "<br>content type: " & contentType & _
                  "<br>content length: " & contentLength.ToString()
            Catch exc As Exception
                Me.Label1.Text = "Failed uploading file"
            End Try
        End If

    End Sub
End Class
